package bishizhuanyong.小红书;

import java.util.Arrays;
import java.util.Scanner;

public class Main {


    public static int minCost=Integer.MAX_VALUE;
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n = s.nextInt();
        int[] num=new int[n];
        for (int i=0;i<num.length;i++)
            num[i]=s.nextInt();
        for (int i=0;i<num.length;i++){
            process(num,0,i,0,1);
        }
        System.out.println(minCost);
        process_tanxin(num);
    }

    //看了评论，用贪心做
    public static void process_tanxin(int[] num){

    }

    public static void process(int[] num,int index,int target_index,int sum,int pre){
        if (index==num.length){
            if (pre==7)
                 minCost=Math.min(minCost,sum);
            return;
        }
        if (target_index==index){
            if (num[index]>=0){
                process(num,index+1,target_index,sum+num[index]-(-7),pre*(-7));
                process(num,index+1,target_index,sum+Math.abs(num[index]-7),pre*7);
            }else {
                process(num,index+1,target_index,sum+7-num[index],pre*7);
                process(num,index+1,target_index,sum+Math.abs(num[index]+7),pre*(-7));
            }
        }else {
            if (num[index]>=0){
                process(num,index+1,target_index,sum+num[index]-(-1),-pre);
                process(num,index+1,target_index,sum+Math.abs(num[index]-1),pre);
            }else {
                process(num,index+1,target_index,sum+1-num[index],pre);
                process(num,index+1,target_index,sum+Math.abs(num[index]+1),-pre);
            }
        }

    }

}

/*
Scanner s=new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();
        int k = s.nextInt();
        int[] num=new int[n];
        for (int i=0;i<num.length;i++)
            num[i]=s.nextInt();
        int gid=(int)Math.ceil((double)k/n);
        boolean reverse=false;
        if (gid%2==0)
            reverse=true;
        int pos=k-(k/n)*n;
        if (reverse)
            pos=n-pos+1;
        System.out.println(num[pos-1]);
 */
